﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Data.Model;
using DotNet.Common.NHibernateUtil;
using NHibernate;
using ZLCMS.Web.Wap.Code;
using ZLCMS.Commands.Data;

namespace ZLCMS.Web.Wap.Shop
{
    public partial class CommentDetail : MemberPageBase
    {
        protected ProductData ProductData { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            using(ISession session = SessionFactoryHelper.CreateSession())
            {
                string sql = @"select op.product_no as ProductNo,op.product_name as ProductName,op.PRODUCT_IMAGE as ThumbnailImg,op.PRODUCT_SUMMARY as ShortDesc,
op.SALE_PRICE as SalePrice from shop_order_product op inner join shop_order_info o on o.ORDER_NO=op.ORDER_NO
where op.COMMENT_STATUS='0'and o.member_account=:member and op.product_no=:pno";
                ProductData = session.CreateSQLQuery(sql)
                    .SetParameter("member", CurrentMemberAccount)
                    .SetParameter("pno", Request["no"])
                    .SetResultTransformer(new ObjectResultTransformer(typeof(ProductData)))
                    .SetMaxResults(1)
                    .UniqueResult<ProductData>();

                if (ProductData == null)
                {
                    Response.Write("参数错误！");
                    Response.End();
                }
            }
        }
    }
}